<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <h1>10000~99999之间的回文数有</h1>
    <div id="box"></div>
</body>
<script>
    var box = document.getElementById('box');
    var sum = '';
    var j = 0;/**/
    for(var i = 10000; i <= 99999;i++){
        /*求出第1、2、4、5位的数字*/ 
        var a = parseInt(i / 10000) ;
        var b = parseInt(i % 10000 / 1000) ;
        var c = parseInt(i % 100 / 10) ;
        var d = parseInt(i % 10) ;
        /*加入回文数的判断*/ 
        if( a == d && c == b){
            j++;/*计数器*/
            sum += i + ' ';/*将得出的各个数进行叠加显示*/
            if(j % 8 == 0){/*一行显示多少个回文数*/
                sum += '<br>';
            }
        }
    }
    box.innerHTML = sum;/*输出到容器*/
</script>
</html>